package presentacion.vista;

import accesoDatos.util.Log;
import accesoDatos.vo.Empleado;
import javax.swing.JFrame;
import presentacion.util.Ventana;

/**
 *
 * @author  Familia
 */
public class VistaCocina extends javax.swing.JFrame {

    private JFrame parent = null;
    private Empleado empleado = null;
    private DialogoCambiarContraseña cambiarContraseña = null;   
    

    /** Creates new form VistaCocina */
    public VistaCocina(JFrame parent, Empleado empleado) {
        this.parent = parent;
        this.empleado = empleado;     
        initComponents();        
        areaDescripcion.setEnabled(false);
        campoNombre.setText(empleado.getNombre());
        campoCargo.setText(empleado.getCargo());
        campoId.setText(empleado.getId().toString());            
       
        Log.setEvento("Cliente", "INFO", "Se Ejecuta Interfaz de Cocina.");
        Ventana.pantallaCompleta(this);
        
        this.setVisible(true);
        parent.setVisible(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelDatosEmpleado = new javax.swing.JPanel();
        nombre = new javax.swing.JLabel();
        campoNombre = new javax.swing.JTextField();
        cargo = new javax.swing.JLabel();
        campoCargo = new javax.swing.JTextField();
        id = new javax.swing.JLabel();
        campoId = new javax.swing.JTextField();
        panelTablaPedidos = new javax.swing.JPanel();
        tablaPedidos = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        botonNotificar = new javax.swing.JButton();
        panelAccionesEmpleado = new javax.swing.JPanel();
        botonCambiarContraseña = new javax.swing.JButton();
        botonCerrarSesion = new javax.swing.JButton();
        areaDescripcion = new javax.swing.JTextField();
        mesas = new javax.swing.JScrollPane();
        panelMesas = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);

        panelDatosEmpleado.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Datos Empleado", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 2, 12), new java.awt.Color(102, 102, 102)));

        nombre.setText("Nombre : ");

        campoNombre.setEditable(false);
        campoNombre.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        cargo.setText("Cargo : ");

        campoCargo.setEditable(false);
        campoCargo.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        id.setText("ID : ");

        campoId.setEditable(false);
        campoId.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        javax.swing.GroupLayout panelDatosEmpleadoLayout = new javax.swing.GroupLayout(panelDatosEmpleado);
        panelDatosEmpleado.setLayout(panelDatosEmpleadoLayout);
        panelDatosEmpleadoLayout.setHorizontalGroup(
            panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosEmpleadoLayout.createSequentialGroup()
                .addGap(56, 56, 56)
                .addComponent(nombre, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 295, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(79, 79, 79)
                .addComponent(cargo, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoCargo, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(139, 139, 139)
                .addComponent(id, javax.swing.GroupLayout.DEFAULT_SIZE, 26, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoId, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                .addGap(51, 51, 51))
        );
        panelDatosEmpleadoLayout.setVerticalGroup(
            panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelDatosEmpleadoLayout.createSequentialGroup()
                .addGroup(panelDatosEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nombre, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(campoNombre)
                    .addComponent(id, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(campoId)
                    .addComponent(cargo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(campoCargo))
                .addContainerGap())
        );

        jTable1.setFont(new java.awt.Font("Tahoma", 0, 12));
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Mesa", "Producto", "Descripción"
            }
        ));
        tablaPedidos.setViewportView(jTable1);

        botonNotificar.setFont(new java.awt.Font("Tahoma", 0, 18));
        botonNotificar.setText("NOTIFICAR");

        botonCambiarContraseña.setFont(new java.awt.Font("Tahoma", 0, 18));
        botonCambiarContraseña.setText("Cambiar Contraseña"); // NOI18N
        botonCambiarContraseña.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCambiarContraseñaActionPerformed(evt);
            }
        });

        botonCerrarSesion.setFont(new java.awt.Font("Tahoma", 0, 18));
        botonCerrarSesion.setText("Cerrar Sesion"); // NOI18N
        botonCerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botonCerrarSesionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelAccionesEmpleadoLayout = new javax.swing.GroupLayout(panelAccionesEmpleado);
        panelAccionesEmpleado.setLayout(panelAccionesEmpleadoLayout);
        panelAccionesEmpleadoLayout.setHorizontalGroup(
            panelAccionesEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelAccionesEmpleadoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(botonCambiarContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addComponent(botonCerrarSesion, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelAccionesEmpleadoLayout.setVerticalGroup(
            panelAccionesEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelAccionesEmpleadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelAccionesEmpleadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botonCambiarContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(botonCerrarSesion, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout panelTablaPedidosLayout = new javax.swing.GroupLayout(panelTablaPedidos);
        panelTablaPedidos.setLayout(panelTablaPedidosLayout);
        panelTablaPedidosLayout.setHorizontalGroup(
            panelTablaPedidosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTablaPedidosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelTablaPedidosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelTablaPedidosLayout.createSequentialGroup()
                        .addComponent(tablaPedidos, javax.swing.GroupLayout.DEFAULT_SIZE, 703, Short.MAX_VALUE)
                        .addContainerGap())
                    .addComponent(areaDescripcion, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelTablaPedidosLayout.createSequentialGroup()
                        .addComponent(botonNotificar, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelTablaPedidosLayout.createSequentialGroup()
                        .addComponent(panelAccionesEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        panelTablaPedidosLayout.setVerticalGroup(
            panelTablaPedidosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTablaPedidosLayout.createSequentialGroup()
                .addComponent(panelAccionesEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addComponent(tablaPedidos, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(areaDescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(botonNotificar, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        mesas.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        mesas.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        mesas.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        javax.swing.GroupLayout panelMesasLayout = new javax.swing.GroupLayout(panelMesas);
        panelMesas.setLayout(panelMesasLayout);
        panelMesasLayout.setHorizontalGroup(
            panelMesasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1218, Short.MAX_VALUE)
        );
        panelMesasLayout.setVerticalGroup(
            panelMesasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1076, Short.MAX_VALUE)
        );

        mesas.setViewportView(panelMesas);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(panelTablaPedidos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(mesas, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(panelDatosEmpleado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(mesas, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE))
                    .addComponent(panelTablaPedidos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelDatosEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1012)/2, (screenSize.height-635)/2, 1012, 635);
    }// </editor-fold>//GEN-END:initComponents

    
    private void botonCambiarContraseñaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCambiarContraseñaActionPerformed
        if (cambiarContraseña == null) {
            cambiarContraseña = new DialogoCambiarContraseña(this, true);
        }
        
        cambiarContraseña.resetAll();
        cambiarContraseña.setEmpleado(this.empleado);
        cambiarContraseña.pack();
        cambiarContraseña.setVisible(true);
    }//GEN-LAST:event_botonCambiarContraseñaActionPerformed

    private void botonCerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCerrarSesionActionPerformed
        parent.setVisible(true);
        this.dispose();
        Log.setEvento("Servidor", "INFO", "Se Cierra Interfaz de Cajero.");
        Log.setEvento("Servidor", "INFO", "Se Ejecuta Interfaz de Iniciar Sesion.");
    }//GEN-LAST:event_botonCerrarSesionActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void ejecutar(final JFrame parent, final Empleado empleado) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new VistaCocina(parent, empleado);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField areaDescripcion;
    private javax.swing.JButton botonCambiarContraseña;
    private javax.swing.JButton botonCerrarSesion;
    private javax.swing.JButton botonNotificar;
    private javax.swing.JTextField campoCargo;
    private javax.swing.JTextField campoId;
    private javax.swing.JTextField campoNombre;
    private javax.swing.JLabel cargo;
    private javax.swing.JLabel id;
    private javax.swing.JTable jTable1;
    private javax.swing.JScrollPane mesas;
    private javax.swing.JLabel nombre;
    private javax.swing.JPanel panelAccionesEmpleado;
    private javax.swing.JPanel panelDatosEmpleado;
    private javax.swing.JPanel panelMesas;
    private javax.swing.JPanel panelTablaPedidos;
    private javax.swing.JScrollPane tablaPedidos;
    // End of variables declaration//GEN-END:variables
}
